package com.spzx.channel.Contoller;

import com.spzx.channel.service.IProductService;
import com.spzx.common.core.web.page.TableDataInfo;
import com.spzx.product.api.domain.vo.SkuQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.ServletException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * projectName: spzx-parent
 *
 * @author: 王宝贵
 * time: 2024/10/9 14:24 周三
 * description: 商品列表条件查询 （用户端）
 */
@RestController
@RequestMapping("list")
@Tag(name = "商品列表条件查询 （用户端）")
public class ProductController  extends  BrandController{


    @Autowired
    private IProductService productService;


    @GetMapping("/skuList/{pageNum}/{pageSize}")
    @Operation(summary = "商品条件查询")
    public TableDataInfo skuList(
            @Parameter(name = "pageNum", description = "当前页码", required = true)
            @PathVariable(name = "pageNum") Integer pageNum,
            @Parameter(name = "pageSize", description = "每页记录数", required = true)
            @PathVariable(name = "pageSize") Integer pageSize,
            @Parameter(name = "skuQuery", description = "查询对象", required = true)
            @SpringQueryMap SkuQuery skuQuery
            ) throws ServletException {
        //远程调用已经分页了 这里只需要将num 和size传到service就行
        TableDataInfo tableDataInfo= productService.skuList(pageNum,pageSize, skuQuery);
        return tableDataInfo;
    }



}